package com.jw.blog.wblog.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author wan Email-wlf18726994755@163.com
 * @version 1.0
 * @className IndexController
 * @date 2020/6/18 13:54
 **/
@RestController
public class IndexController {
    @GetMapping(value = {"/","/index"})
    public ModelAndView index(){
        return new ModelAndView("page/index");
    }

    @GetMapping(value = "/list")
    public ModelAndView list(){
        return new ModelAndView("page/list");
    }

    @GetMapping(value = "/result")
    public ModelAndView result(@RequestParam(value = "keyboard",required = false) String keyboard){

        ModelAndView view = new ModelAndView();
        view.addObject("keyword",keyboard);
        view.setViewName("page/result");
        return view;
    }

    @GetMapping(value = "/resource")
    public ModelAndView resource(){
        return new ModelAndView("page/resource");
    }

    @GetMapping(value = "/about")
    public ModelAndView about(){
        return new ModelAndView("page/about");
    }
    @GetMapping(value = "/message")
    public ModelAndView message(){
        return new ModelAndView("page/message");
    }


    @GetMapping(value = "/login")
    public ModelAndView login(){
        return new ModelAndView("login");
    }

    @GetMapping(value = "/admin")
    public ModelAndView admin(){
        return new ModelAndView("admin/index");
    }

    @GetMapping("/blackIp")
    public ModelAndView blackIp(){
        return new ModelAndView("error/blackIp");
    }
}
